package com.jiahua.utils.file;

import java.io.File;
import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public class FileUploadUtil {



//	public boolean fileUpload (File flie) { 
//	FileInputStream in = null; 
//	Connection conn = null; 
//	PreparedStatement ps = null; 
//	try { 
//	in = new FileInputStream (flie); 
//	String sql = "insert into savepicture (picture) value (?)"; 
//	conn = GetConnection.getConn (); 
//	if (conn == null) { 
//	System.out.println ("Connection is null"); 
//	return false; 
//	} 
//	the ps = conn.prepareStatement (sql); 
//	ps.setBinaryStream (1, in, in.available ()); 
//	if (ps.executeUpdate ()> 0) { 
//	GetConnection.close (conn, PS, null); 
//	return true; 
//	} Else { 
//	GetConnection.close (conn, PS, null); 
//	return false; 
//	} 
//	} Catch (Exception e) { 
//	System.out.println (e.getMessage ()); 
//	GetConnection.close (conn, PS, null); 
//	return false; 
//	} 
//	
	
//	 public List <Picture> findAll () { 
//	List <Picture> list = new ArrayList <Picture> (); 
//	Picture pic = null; 
//	Connection conn = null; 
//	PreparedStatement ps = null; 
//	ResultSet rs = null; 
//	try { 
//	String sql = "select id from savepicture"; 
//	conn = GetConnection.getConn (); 
//	if (conn == null) { 
//	System.out.println ("Connection is null"); 
//	return null; 
//	} 
//	the ps = conn.prepareStatement (sql); 
//	the RS = ps.executeQuery (); 
//	while (rs.next ()) { 
//	pic = new Picture (); 
//	pic.setId (rs.getInt ("id")); 
//	the list.add (pic); 
//	} 
//	GetConnection.close (conn, ps, rs); 
//	return list; 
//	} Catch (Exception e) { 
//	e.printStackTrace (); 
//	GetConnection.close (conn, ps, rs); 
//	return null; 
//	}
}
